
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <functional>
#include "config.h"

std::map<std::string, std::function<void()> > m_tests;

void add_test(std::string const & name, std::function<void()> fun)
{
	m_tests[name] = fun;
}

#define A(name, f) extern void f();
#include "main.h"
#undef A

void show_names()
{
	cout << "valid test:\t" << endl;
	for(auto & i : m_tests)
	{
		cout << i.first << " ";
	}
	cout << endl;
}

bool run_test(std::string const & name)
{
	auto i = m_tests.find(name);
	if(i == m_tests.end()) return false;
	cout << string(12, '*') << endl;
	i->second();
	cout << string(12, '*') << endl;

	return true;
}
#include "go.h"

int main()
{
	go();
#define A(name, f) add_test(name, &f);
#include "main.h"
#undef A

	string cmd;
	show_names();
	while(cin >> cmd)
	{
		if(!run_test(cmd)) cout << "no test named:" << cmd << endl;
		show_names();
	}
	return 0;
}
